﻿$(function () {
    $.ajax({
        type: "Get",
        url: "ProductList",
        data: null,
        success: function (response) {
            var productList = response.ProductList;

            var html = [];
            html.push("<ul class='marketing_list index_m_list js_pl'>");
            for (var i = 0; i < productList.length; i++) {
                var product = productList[i];
                html.push("<li> <div class='product_img'>");
                html.push("<img height='auto' src='/Public/ResStatic/Images/Product/" + product.ImageUrl + "' alt='' title=''>");
                html.push("<p>" + product.ShortDesc + "</p></div>");
                html.push("<div class='pro_info'> " + product.Desc + "</div></li>");
            }
            html.push(" </ul>");
            $("#productList").html(html.join(""));
        },
        dataType: "json"
    });


    // 滑动
    $(document).on("swipeleft swiperight", "#projctPage", function (event) {
        var listitem = $(this);
        var dir = event.type === "swipeleft" ? "left" : "right";

        if (dir == "right") {
            window.history.back(-1);
        }
    });

});
